package com.bj.zspace.cat.controller;

import com.dianping.cat.Cat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:liuwenqing
 * @Date:2024/12/4 22:58
 * @Description:
 * 开源版本不支持: Metric 不支持Tag的功能
 **/
@RestController
public class MetricTest {

    @GetMapping(value = "/metric")
    public String metric() {

        Cat.logMetricForCount("metricForCount");
        Cat.logMetricForCount("metricForCountQuantity", 2);
        Cat.logMetricForDuration("metricForDuration", 12);
        Cat.logMetricForSum("forSum", 1.0);
        Cat.logMetricForSum("forSumQuantity", 1.0, 2);
        return "ok";
    }
    // 标签测试
    @GetMapping(value = "/metric1")
    public String metric1() {
        Cat.getProducer().logMetric("order_tag", "C", "1&lwq");
        Cat.getProducer().logMetric("order_tag", "C", "1&lxy");
        return "ok";
    }

}
